package top.yihoxu.yoj.judge.codesandbox.impl;

import top.yihoxu.yoj.enums.JudgeInfoMessageEnum;
import top.yihoxu.yoj.enums.QuestionSubmitStatusEnum;
import top.yihoxu.yoj.judge.codesandbox.CodeSandbox;
import top.yihoxu.yoj.judge.codesandbox.model.ExecuteCodeRequest;
import top.yihoxu.yoj.judge.codesandbox.model.ExecuteCodeResponse;
import top.yihoxu.yoj.judge.codesandbox.model.JudgeInfo;

import java.util.List;

/**
 * @Author dth
 * @Date 2024/5/3 21:06
 * @PackageName:top.yihoxu.yoj.judge.codesandbox.impl
 * @ClassName: ThirdPartyCodeSandBox
 * @Description: 实例代码码沙箱
 * @Version 1.0
 */
public class ExampleCodeSandBox implements CodeSandbox {
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        List<String> inputList = executeCodeRequest.getInputList();
        ExecuteCodeResponse executeCodeResponse = new ExecuteCodeResponse();
        executeCodeResponse.setOutputList(inputList);
        executeCodeResponse.setMessage("测试执行成功");
        executeCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCESS.getValue());
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getValue());
        judgeInfo.setMemory(100L);
        judgeInfo.setTime(100L);

        executeCodeResponse.setJudgeInfo(judgeInfo);

        return executeCodeResponse ;
    }
}
